package com.csdj.questions.service;

import com.csdj.questions.entity.DiachronicRecord;
import com.csdj.questions.mapper.DiachronicRecordMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 历史记录表 服务实现类
 * </p>
 *
 * @author 刘宇
 * @since 2022-03-11
 */
@Service
public class DiachronicRecordService extends ServiceImpl<DiachronicRecordMapper, DiachronicRecord> implements IDiachronicRecordService {
    @Resource
    private DiachronicRecordMapper diachronicRecordMapper;
    /**
     * 搜索框的历史记录查询
     * @return
     */
    @Override
    public DiachronicRecord selectRecord(int uid) {
       DiachronicRecord diachronicRecord = diachronicRecordMapper.selectById(uid);
        return diachronicRecord;
    }


    /**
     * 根据id 删除记录
     * @param id
     * @return
     */
    @Override
    public int deleteIdDiachronicRecord(int id){
        int jg = diachronicRecordMapper.deleteById(id);
        return jg;
    }

    /**
     * 删除 所有记录
     * @return
     */
    @Override
    public int truncateDiachronicRecord(){
        int jg = diachronicRecordMapper.truncateDiachronicRecord();
        return jg;
    }
}
